package com.gr.yupao.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

@Configuration
public class SwaggerConfig {

    @Bean
    public Docket createRestApi() {
        return new Docket(DocumentationType.SWAGGER_2)
//                .groupName("用户端接口") // 指定分组名
                .apiInfo(apiInfo())  // 文档信息
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.gr.yupao.controller")) // 你的Controller包路径
                .paths(PathSelectors.any())
                .build();
    }

    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("伙伴匹配系统")           // 文档标题
                .description("这是一个伙伴匹配系统接口文档")  // 描述
                .contact(new Contact("gr", "", ""))  // 作者信息
                .version("1.0")                 // 版本号
                .build();
    }
}
